﻿using DevExpress.XtraBars;

namespace KTX
{
    public partial class fMain : DevExpress.XtraBars.Ribbon.RibbonForm
    {
        public fMain()
        {
            InitializeComponent();
        }

        private void barDoiTuong_ItemClick(object sender, ItemClickEventArgs e)
        {
            if (KiemtraQuyen(sender))
            { return; }
            var f = new frmDoiTuong();
            f.MdiParent = this;
            f.Show();
        }

        private void barDayNha_ItemClick(object sender, ItemClickEventArgs e)
        {
            if (KiemtraQuyen(sender))
            { return; }
            var f = new frmDayNha();
            f.MdiParent = this;
            f.Show();
        }

        private void barPhong_ItemClick(object sender, ItemClickEventArgs e)
        {
            if (KiemtraQuyen(sender))
            { return; }
            var f = new frmPhong();
            f.MdiParent = this;
            f.Show();
        }

        private void barLop_ItemClick(object sender, ItemClickEventArgs e)
        {
            if (KiemtraQuyen(sender))
            { return; }
            var f = new frmLop();
            f.MdiParent = this;
            f.Show();
        }

        private void barSV_ItemClick(object sender, ItemClickEventArgs e)
        {
            if (KiemtraQuyen(sender))
            { return; }
            var f = new frmSinhVien();
            f.MdiParent = this;
            f.Show();
        }

        private void barDienNuoc_ItemClick(object sender, ItemClickEventArgs e)
        {
            if (KiemtraQuyen(sender))
            { return; }
            var f = new frmKhoiTaoDienNuoc();
            f.MdiParent = this;
            f.Show();
            
        }

        private void barBHopDong_ItemClick(object sender, ItemClickEventArgs e)
        {
            if (KiemtraQuyen(sender))
            { return; }
            var f = new frmHopDong();
            f.MdiParent = this;
            f.Show();
        }

        private void barDienNuocThang_ItemClick(object sender, ItemClickEventArgs e)
        {
            if (KiemtraQuyen(sender))
            { return; }
            var f = new frmDienNuoc();
            f.MdiParent = this;
            f.Show();
        }

        private void barButtonItem1_ItemClick(object sender, ItemClickEventArgs e)
        {
            if (KiemtraQuyen(sender))
            { return; }
            var f = new frmHopDongDaKy();
            f.MdiParent = this;
            f.Show();
        }

        private void barButtonItem2_ItemClick(object sender, ItemClickEventArgs e)
        {
            if (KiemtraQuyen(sender))
            { return; }
            var f = new frmTimKiemSinhvien();
            f.MdiParent = this;
            f.Show();
        }

        private void barButtonItem3_ItemClick(object sender, ItemClickEventArgs e)
        {
            if (KiemtraQuyen(sender))
            { return; }
            var f = new frmThongKeDienNuoc();
            f.MdiParent = this;
            f.Show();
        }

        private void barButtonItem5_ItemClick(object sender, ItemClickEventArgs e)
        {
            if (KiemtraQuyen(sender))
            { return; }
            var f = new frmThongKeDienNuoc();
            f.MdiParent = this;
            f.Show();
        }

        private void barButtonItem6_ItemClick(object sender, ItemClickEventArgs e)
        {
            if (KiemtraQuyen(sender))
            { return; }
            var f = new frmNguoiDung();
            f.MdiParent = this;
            f.Show();
        }
        Data.NguoiDung NguoiDung;
        private void fMain_Load(object sender, System.EventArgs e)
        {
            var f = new frmDangNhap();
            NguoiDung = f.ShowMe();
            if (NguoiDung == null)
            {
                this.Close();
            }
        }
        bool KiemtraQuyen(object sender)
        {
            
            
            return false;
        }

        private void barCanBo_ItemClick(object sender, ItemClickEventArgs e)
        {
            if (KiemtraQuyen(sender))
            { return; }
            var f = new frmCanBo();
            f.MdiParent = this;
            f.Show();
        }

        private void barButtonItem4_ItemClick(object sender, ItemClickEventArgs e)
        {

            if (KiemtraQuyen(sender))
            { return; }
            var f = new frmHopDongDaKy();
            f.MdiParent = this;
            f.Show();
        }
    }
}